#pragma once

#include <allegro5\allegro.h>
#include <allegro5\allegro_image.h>
#include <allegro5\allegro_primitives.h>

#include <string>

#include "Viewport.h"
#include "Geometry.h"

class Entity
{
private:
	ALLEGRO_BITMAP *texture;

	std::string name;

	float x;
	float y;

	bool selected;
	bool selectable;
	bool selectableMulti;

	int texOffsetX;
	int texOffsetY;

	int texWidth;
	int texHeight;

	void init(char *texturePath, std::string name, int texOffsetX, int texOffsetY);

	//TODO: Add texture offset (e.g. feet of playertexture)

public:
	void setSelected( bool selected ) { Entity::selected = selected; }
	bool isSelected() { return selected; }
	void select() { Entity::setSelected(true); }
	void deselect() { Entity::setSelected(false); }
	
	void setSelectable( bool selectable ) { Entity::selectable = selectable; }
	bool isSelectable() { return selectable; }

	void setPosition(float x, float y) { Entity::x = x; Entity::y = y; }
	float getX() { return Entity::x; }
	float getY() { return Entity::y; }

	int getTexWidth() { return texWidth; };
	int getTexHeight() { return texHeight; };

	void update(void);
	void draw(Viewport *vp);

	Entity(char *texturePath, std::string name);
	Entity(char *texturePath, std::string name, int texOffsetX, int texOffsetY);
	Entity(const Entity &ent);
	~Entity(void);
};

